import React, { Component } from 'react'
import { connect } from 'react-redux'

class Toast extends Component {
  render() {
    const { show, text, type } = this.props
    return show ? (
      <div className="toast_out">
        <div className={`${type === 'dm' ? 'dm_toast' : 'qa_toast'}`}>
          <div className="toast">{text}</div>
        </div>
      </div>
    ) : null
  }
}
const mapStateToProps = (state) => {
  return state.ToastState
}

export default connect(mapStateToProps)(Toast)
